import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import app from './modules/app'
import settings from './modules/settings'
import user from './modules/user'
import menus from './modules/menus'

Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    app,
    settings,
    user,
    menus

  },
  getters
})

// // export default store

// import Vue from 'vue'
// import Vuex from 'vuex'
// import getters from './getters'

// Vue.use(Vuex)

// const req = require.context('./modules', false, /\.js$/)

// // 获取模块的名字
// const mName = req.keys().map(item => { return item.split('./')[1] }).map(item => { return item.split('.js')[0] })
// // 获取所有的模块
// const mModule = req.keys().map(req)

// const obj = {}

// mName.forEach((key, index) => {
//   console.log('key', key)
//   console.log('index', index)
//   obj[key] = mModule[index].default
// })
// console.log('obj', obj)

// const store = new Vuex.Store({
//   modules: obj,
//   getters: getters
// })

export default store
